import json

with open("./origin.json", "r", encoding="utf-8") as f:
    records = json.load(f)["RECORDS"]


result = []

for record in records:
    desc = record.get("skuDesc")
    name = record.get("skuName")
    short = record.get("skuShortName")

    if not short:
        continue
    if desc:
        result.append({"title": short, "content": desc})
    if name:
        result.append({"title": short, "content": name})

with open("./train.json", "w", encoding="utf-8") as f:
    for one in result:
        f.write(json.dumps(one, ensure_ascii=False)+"\n")

print("total count =", len(result))
